package com.wfy.asyncloader

import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.LifecycleRegistry

/**
 * @author : wangfengyuan
 * e-mail  : 446950883@qq.com
 * time    : 2025/3/21
 * desc    : 创建模拟的 LifecycleOwner
 * version : 1.0
 */
class TestLifecycleOwner : LifecycleOwner {
    private val registry = LifecycleRegistry.createUnsafe(this)
    override fun getLifecycle(): Lifecycle = registry
    fun simulateEvent(event: Lifecycle.Event) {
        registry.handleLifecycleEvent(event)
    }
}